import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: 牛客网.简单题.完全数计算
 */
public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int count = 0;
        for(int i = 2; i < n; i++) {
            int sum = 1;
            for(int j = 2; j <= Math.sqrt(i); j++) {
                if(i % j == 0){
                    sum += j;
                    sum += (i / j);
                }
            }
            if(sum == i) {
                count++;
            }
        }
        System.out.println(count);
    }
}
